
#MUST be this directory
MINGW_DIR = C:/MinGW
CYGWIN_DIR = C:/Cygwin
QT_DIR = C:/Qt/4.4.3

CC = '$(MINGW_DIR)/bin/g++.exe'
MOC = '$(QT_DIR)/bin/moc.exe'
RM = '$(CYGWIN_DIR)/bin/rm.exe' -f

DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -frtti -mwindows -fexceptions -mthreads -Wall $(DEFINES)
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl,-subsystem,windows $(DEFINES)
LIBPATH = -L'$(QT_DIR)/lib'
LIBS = -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lQtOpenGLd4 -lQtGuid4 -lQtCored4

INCLUDE = -I'$(QT_DIR)/include' -I'$(QT_DIR)/include/QtCore' -I'$(QT_DIR)/include/QtGui' \
		  -I'$(QT_DIR)/include/QtGui' -I'$(QT_DIR)/include/QtOpenGL' -I'$(QT_DIR)/include/QtOpenGL' \
		  -I'$(QT_DIR)/include/ActiveQt' -I'$(QT_DIR)/mkspecs/win32-g++'

TARGET = Shamandalie.exe

OBJS = main.o window.o glwidget.o window_moc.o glwidget_moc.o

default = target

PATH = $(MINGW_DIR)/bin;$(MINGW_DIR)/libexec/gcc/mingw32/3.4.2;$(QT_DIR)/bin;$(QT_DIR)/lib;$(CYGWIN_DIR)/bin

.PHONY = all
all: target

.PHONY = target
target: $(OBJS)
	$(CC) $(LFLAGS) $(LIBPATH) $(OBJS) $(LIBS)  -o ../bin/$(TARGET)

%.o: %.cpp
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
	
%_moc.cpp: %.h
	$(MOC) $(DEFINES) $(INCLUDE) $< -o $@

.PHONY = clean
clean:
	$(RM) $(OBJS)
	$(RM) ../bin/$(TARGET)

.PHONY = run	
run:
	../bin/$(TARGET)
